package com.whz.governance.monitor;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

/**
 * @author whz
 */
@Slf4j
@Configuration
@EnableAspectJAutoProxy(exposeProxy = true, proxyTargetClass = true)
@ConditionalOnProperty(name = "generic.time.cost.monitor.enable", havingValue = "true")
public class TimeCostMonitorConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public TimeCostMonitorAopBean createTongyuMonitorAopBean() {
        log.info("===== 注入@TimeCostMonitor, @RequestMapping 耗时监控.");
        return new TimeCostMonitorAopBean();
    }
}